import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseinfoVO, BaseinfoForm, BaseinfoQuery } from '@/api/agriculture/baseinfo/types';

/**
 * 查询基地信息列表
 * @param query
 * @returns {*}
 */

export const listBaseinfo = (query?: BaseinfoQuery): AxiosPromise<BaseinfoVO[]> => {
  return request({
    url: '/agriculture/baseinfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询基地信息详细
 * @param baseId
 */
export const getBaseinfo = (baseId: string | number): AxiosPromise<BaseinfoVO> => {
  return request({
    url: '/agriculture/baseinfo/' + baseId,
    method: 'get'
  });
};

/**
 * 新增基地信息
 * @param data
 */
export const addBaseinfo = (data: BaseinfoForm) => {
  return request({
    url: '/agriculture/baseinfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改基地信息
 * @param data
 */
export const updateBaseinfo = (data: BaseinfoForm) => {
  return request({
    url: '/agriculture/baseinfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除基地信息
 * @param baseId
 */
export const delBaseinfo = (baseId: string | number | Array<string | number>) => {
  return request({
    url: '/agriculture/baseinfo/' + baseId,
    method: 'delete'
  });
};
